--- truecrypt-6.3-source/Core/Unix/Linux/CoreLinux.cpp	2009-10-21 15:11:02.000000000 +0200
+++ truecrypt-6.3-source.src/Core/Unix/Linux/CoreLinux.cpp	2009-10-26 14:26:24.741564814 +0100
@@ -90,13 +90,23 @@
 	void CoreLinux::DetachLoopDevice (const DevicePath &devicePath) const
 	{
 		list <string> args;
+		list <string> args2;
 		args.push_back ("-d");
 		args.push_back (devicePath);
+                /* args2 needed to umount loop device before detaching it
+                by Enrico Lo Tauro (neongen)*/
+                args2.push_back (devicePath);
 
 		for (int t = 0; true; t++)
 		{
 			try
 			{
+	 		        try
+                                {Process::Execute ("umount", args2);
+                                }
+                                catch (ExecutedProcessFailed&)
+                                {
+                                }
 				Process::Execute ("losetup", args);
 				break;
 			}
